
#ifndef COMMON_FUNCTION_
#define COMMON_FUNCTION_
#include <vector>
#include <sys/time.h>

using namespace std;

struct my_timer
{
    struct timeval start_time, end_time;
    double time_use;

    void start()
    {
        gettimeofday(&start_time, NULL);
    }

    void stop()
    {
        gettimeofday(&end_time, NULL);
        time_use = (end_time.tv_sec-start_time.tv_sec)*1.0e6 + end_time.tv_usec-start_time.tv_usec;
    }
};
#endif 